﻿Imports Microsoft.Xna.Framework
Imports Runa.Resources.ResourceManager
Imports System.IO

Namespace Global.Runa.UI.Metadata

    Public Class AudioObjectConverter
        Inherits TypeConverter

        Public Sub New(g As Game)
            MyBase.New(g)
        End Sub

        Public Overrides Function ConvertFromInvariantString(text As String) As Object
            Return New AudioObject(Path.GetFileNameWithoutExtension(text), text)
        End Function

        Public Overrides Function ConvertFromString(text As String) As Object
            Return ConvertFromInvariantString(text)
        End Function

        Public Overrides Function ConvertToInvariantString(value As Object) As String
            Return CType(value, AudioObject).FileName
        End Function

        Public Overrides Function ConvertToString(value As Object) As String
            Return ConvertToInvariantString(value)
        End Function

        Public Overrides Function CreateInstance(propertyValues As IDictionary) As Object
            Return New AudioObject(propertyValues.Values(0).ToString(), propertyValues.Values(1).ToString())
        End Function

        Public Overrides Function GetCreateInstanceSupported() As Boolean
            Return True
        End Function

        Public Overrides Function GetPropertiesSupported() As Boolean
            Return False
        End Function

        Public Overrides Function GetStandardValuesSupported() As Boolean
            Return False
        End Function

    End Class

End Namespace